using System;
using System.IO;
using System.Runtime.CompilerServices;

namespace Lottery.Client.SL
{
    public class PlayData
    {
        [CompilerGenerated]
        private int ppNXiL97Ph;
        [CompilerGenerated]
        private string E6ZXjrrvjJ;
        [CompilerGenerated]
        private DateTime NafXGde7Xj;
        [CompilerGenerated]
        private DateTime ju3XYyUo89;
        [CompilerGenerated]
        private DateTime ADdXvt0i6q;
        [CompilerGenerated]
        private string a4iXmBWEou;
        public int IsuseID
        {
            get;
            set;
        }
        public string IsusesName
        {
            get;
            set;
        }
        public DateTime StartTime
        {
            get;
            set;
        }
        public DateTime AheadEndTime
        {
            get;
            set;
        }
        public DateTime EndTime
        {
            get;
            set;
        }
        public string BonusNumber
        {
            get;
            set;
        }
        public string ZXType
        {
            get
            {
                if (string.IsNullOrEmpty(this.BonusNumber))
                {
                    return "";
                }
                string text;
                if (this.BonusNumber.Length == 5)
                {
                    if (int.Parse(this.BonusNumber.ToCharArray()[3].ToString()) >= 5)
                    {
                        text = "?";
                    }
                    else
                    {
                        text = "?";
                    }
                    if (int.Parse(this.BonusNumber.ToCharArray()[4].ToString()) % 2 == 0)
                    {
                        text = "?";
                    }
                    else
                    {
                        text += "?";
                    }
                }
                else
                {
                    if (int.Parse(this.BonusNumber.ToCharArray()[1].ToString()) >= 5)
                    {
                        text = "?";
                    }
                    else
                    {
                        text = "?";
                    }
                    if (int.Parse(this.BonusNumber.ToCharArray()[2].ToString()) % 2 == 0)
                    {
                        text += "?";
                    }
                    else
                    {
                        text += "?";
                    }
                }
                return text;
            }
        }

        public static PlayData GetPlayData(byte[] bytes)
        {
            MemoryStream memoryStream = new MemoryStream(bytes);
            BinaryReader binaryReader = new BinaryReader(memoryStream);
            PlayData playData = new PlayData();
            playData.IsuseID = binaryReader.ReadInt32();
            playData.IsusesName = binaryReader.ReadString();
            playData.StartTime = Convert.ToDateTime(binaryReader.ReadString());
            playData.EndTime = Convert.ToDateTime(binaryReader.ReadString());
            playData.AheadEndTime = Convert.ToDateTime(binaryReader.ReadString());
            playData.BonusNumber = binaryReader.ReadString();
            binaryReader.Close();
            return playData;
        }
        public static PlayData GetPlayData(BinaryReader br)
        {
            return new PlayData
                       {
                           IsuseID = br.ReadInt32(),
                           IsusesName = br.ReadString(),
                           StartTime = Convert.ToDateTime(br.ReadString()),
                           AheadEndTime = Convert.ToDateTime(br.ReadString()),
                           EndTime = Convert.ToDateTime(br.ReadString()),
                           BonusNumber = br.ReadString()
                       };
        }
    }
}